﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for Configuration
/// </summary>
namespace sConfiguration
{
    public static class Configuration
    {
        private static string dbConnectionString;
        private static string dbProviderName;

        static Configuration()
        {
            dbConnectionString = ConfigurationManager.ConnectionStrings["AptitudeConnect"].ConnectionString;
            dbProviderName = ConfigurationManager.ConnectionStrings["AptitudeConnect"].ProviderName;
        }

        public static string DbConnectString
        {
            get { return dbConnectionString; }
        }

        public static string DbProviderName
        {
            get { return dbProviderName; }
        }

        public static string ConnectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["AptitudeConnect"].ConnectionString.ToString();
            }
        }
        public static SqlConnection Connection
        {
            get
            {
                SqlConnection conn = new SqlConnection(ConnectionString);
                if (conn.State == ConnectionState.Closed)
                    conn.Open();
                return conn;
            }
        }
    }
}